package com.atguigu01.create.exer1;

/**
 * @author NoobMaster69  * @date 2024/6/4 0004 星期二 11:56
 */
public class PrintNumberTest {
    public static void main(String[] args) {
//        EvenNumber t1 = new EvenNumber();
//        t1.start();
//        Person p1 = new Person();
//        AddNumber t2 = new AddNumber();
//        t2.start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    if(i % 2 == 0){
                        System.out.println(Thread.currentThread().getName() + "-->" + i);
                    }
                }
            }
        }){}.start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    if(i % 2 != 0){
                        System.out.println(Thread.currentThread().getName() + "-->" + i);
                    }
                }
            }
        }){}.start();
    }
}
class EvenNumber extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            if(i % 2 == 0){
                System.out.println(Thread.currentThread().getName() + "-->" + i);
            }
        }
    }
}
class AddNumber extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            if(i % 2 != 0){
                System.out.println(Thread.currentThread().getName() + ":" + i);
            }
        }
    }
}
class Person{

}